package com.zheng.pvz.view
{
	import com.zheng.pvz.controller.HitTestClass;
	
	import flash.events.Event;
	import flash.utils.getTimer;

	/**
	 * 游戏对象，植物，僵尸，子弹 
	 * 所有用于检测碰撞的对象
	 * @author Administrator
	 * 
	 */
	public class ElementSprite extends BaseObject
	{
		private var hitTestClass:HitTestClass;
		private var lastTickTime:int;
		
		public function ElementSprite()
		{
			hitTestClass=new HitTestClass();
			
			this.addEventListener(Event.ENTER_FRAME,onEnterFrame);
		}
		
		override public function tick(timeSpan:uint):void{
			hitTestClass.checkHit(this);
		}
		private function onEnterFrame(e:Event):void{
			var timer:int = getTimer();
			var timespan:int = timer - lastTickTime;
			lastTickTime = timer;
			this.tickBase(lastTickTime);
		}
	}
}